<?php
class XTargetPointcut extends XAbstractPointcut{
	public function match($class, $method){
		$match = array();
		if(!preg_match("/^target\((.+)\)/i", $this->pattern, $match)){
			return false;
		}
		$reflection = XClassLoader::loader($match[1])->reflection();
		$loader = XClassLoader::loader($class);
		if($reflection->isInterface()){
			if($loader->implementsInterface($match[1])){
				return true;
			}	
			return false;	
		}
		if($loader->hasAncestor($match[1])){
			return true;
		}
		return false;
	}
}
?>